<!--
  @author mujunlin
  @since 2019/08/15 10:59
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:replace="common/common :: jscss"/>
</head>
<body>
<style>
    .zmn-template-plat-module-block {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .zmn-template-plat-module {
        width: 18%;
        margin-right: 2%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis
    }

    .zmn-template-plat-module .layui-form-radio {
        margin: 0;
        padding: 0;
    }
</style>
<div class="layui-fluid">

    <div class="layui-card">
        <div class="layui-card-body">
            <form method="POST" action="" class="layui-form" lay-filter="zmn-form">
                <!--用于保存或传值的隐藏表单元素
                   置于form标签内的最上方
                   -->
                <input type="hidden" th:value="${msgTemplateGroup.groupId}" name="groupId"/>
                <input type="hidden" th:value="${msgTemplateGroup.status}" name="status"/>

                <div class="layui-card-header layui-margin-b"><b>基本信息</b></div>
                <div class="layui-form-item layui-form-item-sm" th:if="${msgTemplateGroup.groupId>0}">
                    <label class="layui-form-label">模板组ID：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">
                            <span th:text="${msgTemplateGroup.groupId}"></span>&nbsp;&nbsp;
                            <th:block th:switch="${msgTemplateGroup.groupId}">
                                <span th:case="2" class="layui-badge layui-bg-green">已启用</span>
                                <span th:case="1" class="layui-badge">已停用</span>
                            </th:block>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">模板组名称：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="name" placeholder="模板组名称" lay-verify="required"
                               lay-verType="tips" th:value="${msgTemplateGroup.name}"
                               autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">所属平台：</label>
                    <div class="layui-input-block zmn-template-plat-module-block">
                        <zmn class="zmn-template-plat-module" th:each="type:${platTypeList}">
                            <input type="radio" name="plat" th:checked="${type.key == msgTemplateGroup.plat}" th:value="${type.key}"
                                   th:text="${type.value}">
                        </zmn>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">所属模块：</label>
                    <div class="layui-input-block zmn-template-plat-module-block">
                        <zmn class="zmn-template-plat-module" th:lay-tips="${module.moduleName}" th:each="module:${modules}">
                            <input type="radio" name="module" th:checked="${module.moduleId == msgTemplateGroup.module}" th:value="${module.moduleId}"
                                   th:text="${module.moduleName}">
                        </zmn>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button lay-submit="" lay-filter="zmn-form-submit" class="layui-btn"
                                th:if="${#authPermit.checkPermit('/msg/temp/group/addEdit.action')}">提交
                        </button>
                        <button onclick="cancel()" class="layui-btn-primary layui-btn cancleBtn">取消</button>
                    </div>
                </div>
            </form>
        </div>


    </div>
</div>
<script type="text/javascript" th:inline="javascript">
    let json = {
        company: [[${company}]]
    };

    layui.config({
        version: 2019103001,
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        msg_template_group_edit: "message/group/zmn.msg.template.group.edit",
    }).use(['index', 'msg_template_group_edit']);

</script>
</body>
</html>